// vite.config.js
import {
  defineConfig
} from 'vite';
import uni from '@dcloudio/vite-plugin-uni';

export default defineConfig({
  plugins: [uni()],
  server: {
    port:25001,
    proxy: {
      // 如下写法转化请求地址
      // http://localhost:5173/api/
      // -> https://httpbin.org/
      '/apiWeather': {
        target: 'https://wis.qq.com/weather/common',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/apiWeather/, ''),
      },
      '/apiIp': {
        target: 'https://openapi.lddgo.net/base/gtool/api/v1/GetIp',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/apiIp/, ''),
      },
    },
  }
});
